Skip to main content
Glama

Fusion360MCP

by jaskirat1616
fusion mcc.pyβ€’6.56 kB
""" Fusion 360 MCP - Production Ready Version AI-assisted design automation with modern chat UI and enhanced accuracy """ import adsk.core import adsk.fusion import traceback import webbrowser import os import sys def run(context): """Main entry point for Fusion 360 MCP""" ui = None try: app = adsk.core.Application.get() ui = app.userInterface # Ask user what to run result = ui.messageBox( 'What would you like to start?\n\n' '- Click YES to start the BRIDGE (required for code execution)\n' '- Click NO to start the WEB SERVER\n' '- Click CANCEL to exit', 'Fusion 360 MCP', adsk.core.MessageBoxButtonTypes.YesNoCancelButtonType, adsk.core.MessageBoxIconTypes.QuestionIconType ) if result == adsk.core.DialogResults.DialogCancel: return if result == adsk.core.DialogResults.DialogYes: # Start bridge start_bridge(ui) return # Show info dialog for web server result = ui.messageBox( 'Fusion 360 MCP - Production Ready\n\n' 'This will start the MCP server with a modern chat UI.\n\n' 'IMPORTANT: Before starting, ensure you have:\n' '1. Installed required Python packages (see requirements.txt)\n' '2. For Ollama: Server running (ollama serve)\n' '3. For OpenAI/Gemini: Valid API key ready\n\n' 'The server will start on http://localhost:8888\n' 'A browser window will open automatically.\n\n' 'Continue?', 'Fusion 360 MCP', adsk.core.MessageBoxButtonTypes.YesNoButtonType, adsk.core.MessageBoxIconTypes.InformationIconType ) if result == adsk.core.DialogResults.DialogYes: # Start the server in a separate process script_dir = os.path.dirname(os.path.abspath(__file__)) server_script = os.path.join(script_dir, 'server.py') # Check if server script exists if not os.path.exists(server_script): ui.messageBox( f'Server script not found at:\n{server_script}\n\n' 'Please ensure all files are properly installed.', 'Error', adsk.core.MessageBoxButtonTypes.OKButtonType, adsk.core.MessageBoxIconTypes.CriticalIconType ) return # Import and start server try: import subprocess # Use system Python to avoid code signing issues with Fusion's Python # System Python should have all dependencies installed python_exe = '/usr/local/bin/python3' # Check if system python exists, fallback to 'python3' in PATH if not os.path.exists(python_exe): python_exe = 'python3' process = subprocess.Popen( [python_exe, server_script], cwd=script_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE ) # Give server time to start import time time.sleep(2) # Open browser webbrowser.open('http://localhost:8888') ui.messageBox( 'MCP Server started successfully!\n\n' 'Server running at: http://localhost:8888\n' 'Browser window opened.\n\n' 'To stop the server, close the terminal window or press Ctrl+C.\n\n' 'Logs are saved to:\n' '- ~/mcp_server.log\n' '- ~/mcp_core.log', 'Server Started', adsk.core.MessageBoxButtonTypes.OKButtonType, adsk.core.MessageBoxIconTypes.InformationIconType ) except Exception as e: ui.messageBox( f'Failed to start server:\n{str(e)}\n\n' f'You can manually start the server by running:\n' f'python "{server_script}"', 'Error', adsk.core.MessageBoxButtonTypes.OKButtonType, adsk.core.MessageBoxIconTypes.WarningIconType ) except: if ui: ui.messageBox('Failed:\n{}'.format(traceback.format_exc())) def start_bridge(ui): """Start the Fusion 360 Bridge for code execution""" import threading import json import time QUEUE_PATH = os.path.expanduser('~/fusion_mcp_queue.json') RESULT_PATH = os.path.expanduser('~/fusion_mcp_result.json') app = adsk.core.Application.get() running = [True] # Use list for closure def monitor_queue(): while running[0]: try: if os.path.exists(QUEUE_PATH): with open(QUEUE_PATH, 'r') as f: request = json.load(f) os.remove(QUEUE_PATH) # Execute code try: exec_globals = {'adsk': adsk, 'app': app, 'ui': ui} exec(request.get('code', ''), exec_globals) result = {'success': True, 'message': 'Code executed successfully', 'timestamp': time.time()} except Exception as e: result = {'success': False, 'message': str(e), 'timestamp': time.time()} with open(RESULT_PATH, 'w') as f: json.dump(result, f) except Exception as e: print(f"Bridge error: {e}") time.sleep(0.5) # Start monitoring thread thread = threading.Thread(target=monitor_queue, daemon=True) thread.start() ui.messageBox( 'Fusion 360 Bridge Started!\n\n' 'The web UI can now execute code directly in Fusion 360.\n\n' 'Keep Fusion 360 open while using the chat interface.\n\n' 'To stop: Close Fusion 360 or restart the script.', 'Bridge Active' ) # Standalone mode for backward compatibility if __name__ == '__main__': # This allows the old interactive mode to still work print("Starting Fusion 360 MCP in standalone mode...") print("For the new chat UI, run this script from Fusion 360.") print("For manual server start, run: python server.py")

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jaskirat1616/Fusion360MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server